<%@ page language="Java" import="java.util.*,descriptor.*,cv.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%
	TimetableDescriptor des = (TimetableDescriptor)request.getAttribute("EventDescriptor");
	String error1 = (String)request.getAttribute("error1");
	int id = 0;
	String dateStart =  "";
	String eventName = "";
	String recruiter = "";
	String offer = "";
	String notif = "";
	if(des != null)
	{
		id = des.getID();
		dateStart = des.getMonth()+"/"+des.getDay()+"/"+des.getYear()+" "+des.getHour()+":"+des.getMinute();
		eventName = des.getName();
		recruiter = des.getRecruiterName();
		offer = des.getOfferName();
	}
	if(error1 != null)
	{
		notif = "<p style=\"color:red; font-size: 10px;\">" + error1 + "</p>";
	}	
%>
<html>
	<jsp:include page="StudentHeader.jsp" >
		<jsp:param name="pageTitle" value="Work Placement Management System - Student" />
	</jsp:include>
	<body OnLoad="showmenu(document.getElementById('smenu2'));">
		<jsp:include page="StudentPageHeader.jsp"></jsp:include>
		<div id="container">
			<jsp:include page="StudentMenu.jsp" ></jsp:include>
			<div id="content">
				<%
					if(error1 == null)
					{
				%>
				<h3 class="posttitle">Student - Edit an event</h3>
				<div class="entry">
					<form method="post">
						<fieldset>
							<legend>Edit the event</legend>
							<input type="hidden" name="action" value="editedEvent">
							<input type="hidden" name="eventID" value="<%= id %>">
							<p>Start: <input type="text" id="calendar1" name="calendar1" value="<%= dateStart %>"><button type="button" id="trigger">Choose the date</button>
							    <script type="text/javascript">
							      Zapatec.Calendar.setup({
							        firstDay          : 1,
							        range             : [2008.01, 2999.12],
							        electric          : false,
							        inputField        : "calendar1",
							        button            : "trigger",
							        ifFormat          : "%A, %B %d, %Y",
							        daFormat          : "%Y/%m/%d"
							      });
							     </script>
								<br>
							</p>
							<p >Event: <input type="text" name="nameEvent" value="<%= eventName %>"></p>
							<p>Recruiter: <input type="text" id="recruiter" name="recruiterName" value="<%= recruiter %>"></p>
							<p >Offer: <input type="text"name="offerName" value="<%= offer %>"></p>
							<fieldset>
								<legend>Save this event</legend>
								<p><button type="submit">Save Event</button><button type="reset">Undo</button></p>
							</fieldset>
						</fieldset>				
					</form>	
				<%
					}
					else
					{
				%>
					<p><%= notif %></p>
				<%
					}
				%>
				</div>
	    	</div>
			<jsp:include page="StudentPageFooter.jsp"></jsp:include>
		</div>
	</body>
</html>